﻿using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using Wslzy.Auxiliary.Infrastructure.Domains;
using Wslzy.Auxiliary.Infrastructure.Domains.Repositories;

namespace Wslzy.Auxiliary.Infrastructure.Datas.Stores.Operations
{
    /// <summary>
    /// 分页查询
    /// </summary>
    /// <typeparam name="TEntity">对象类型</typeparam>
    /// <typeparam name="TKey">对象标识类型</typeparam>
    public interface IPageQueryAsync<TEntity, in TKey> where TEntity : class, IKey<TKey>
    {
        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="predicate">条件</param>
        /// <param name="pager">order</param>
        /// <returns></returns>
        Task<List<TEntity>> QueryAsync(Expression<Func<TEntity, bool>> predicate, IPager pager);
        /// <summary>
        /// 查询，不跟踪实体
        /// </summary>
        /// <param name="predicate">条件</param>
        /// <param name="pager">order</param>
        /// <returns></returns>
        Task<List<TEntity>> QueryAsNoTrackingAsync(Expression<Func<TEntity, bool>> predicate, IPager pager);
        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="predicate">条件</param>
        /// <param name="pager">pager</param>
        /// <returns></returns>
        Task<PagerList<TEntity>> PagerQueryAsync(Expression<Func<TEntity, bool>> predicate, IPager pager);
        /// <summary>
        /// 分页查询，不跟踪实体
        /// </summary>
        /// <param name="predicate">条件</param>
        /// <param name="pager">pager</param>
        /// <returns></returns>
        Task<PagerList<TEntity>> PagerQueryAsNoTrackingAsync(Expression<Func<TEntity, bool>> predicate, IPager pager);
    }
}
